home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / bin / gdebi-gtk < prev    next >
Encoding:
Text File  |  2007-04-05  |  2.3 KB  |  73 lines

  1. #!/usr/bin/python
  2. #
  3. # Copyright (c) 2005-2007 Canonical
  4. #
  5. # AUTHOR:
  6. # Michael Vogt <mvo@ubuntu.com>
  7. #
  8. # This file is part of GDebi
  9. #
  10. # GDebi is free software; you can redistribute it and/or
  11. # modify it under the terms of the GNU General Public License as published
  12. # by the Free Software Foundation; either version 2 of the License, or (at
  13. # your option) any later version.
  14. #
  15. # GDebi is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18. # General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with GDebi; if not, write to the Free Software
  22. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23. #
  24.  
  25. import sys
  26. import apt
  27. import os.path
  28.  
  29.  
  30. from optparse import OptionParser
  31. from GDebi.GDebi import GDebi
  32.  
  33. from gettext import gettext as _
  34. import gettext
  35.  
  36.  
  37. if __name__ == "__main__":
  38.     data="/usr/share/gdebi"
  39.  
  40.     localesApp="gdebi"
  41.     localesDir="/usr/share/locale"
  42.     gettext.bindtextdomain(localesApp, localesDir)
  43.     gettext.textdomain(localesApp)
  44.  
  45.     parser = OptionParser()
  46.     parser.add_option("-n", "--non-interactive",
  47.                       action="store_true", dest="non_interactive",
  48.                       default=False,
  49.                       help=_("Run non-interactive (dangerous!)"))
  50.     (options, args) = parser.parse_args()
  51.  
  52.     afile = ""
  53.     if len(args) >= 1:
  54.         afile = args[0]
  55.         
  56.     try:
  57.         app = GDebi(datadir=data,options=options,file=afile)
  58.     except SystemError, e:
  59.         err_header = _("Software index is broken")
  60.         err_body = _("This is a major failure of your software " 
  61.                     "management system. Please check for broken packages "
  62.                     "with synaptic, check the file permissions and "
  63.                     "correctness of the file '/etc/apt/sources.list' and "
  64.                     "reload the software information with: "
  65.                     "'sudo apt-get update' and 'sudo apt-get install -f'."
  66.                     )
  67.         self.show_alert(gtk.MESSAGE_ERROR, err_header, err_body)
  68.         sys.exit(1)
  69.         
  70.     if options.non_interactive == True:
  71.         app.on_button_install_clicked(None)
  72.     app.run()
  73.